<div class="form">

<p>Fields with <span class="required">*</span> are required.</p>

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'company-form',
	'enableAjaxValidation'=>false,
)); ?>

	<div class="row">
		<?php echo $form->LabelEx($model,'cname'); ?>
		<?php echo $form->TextField($model, 'cname',array('size'=>40));?>
	</div>

<div class="row buttons">
<?php 
$this->widget('zii.widgets.jui.CJuiButton',array(
   	'name'=>'submit',
   	'id'=>'company_create_submit',
   	'caption'=>($model->getIsNewRecord())?'Create':'Update',
   	'value'=>"create",
));
?>
</div>

<?php $this->endWidget(); ?>
</div><!-- yiiForm -->
<?php
$cs = Yii::app()->getClientScript();
$showUrl = CHtml::normalizeUrl(array('company/view'));
$script =<<<EOD
$.company_form = {
	afterSubmit:function(data){
		if(data.id != '')
			window.location = '$showUrl?id='+data.id;
	}
};
$('#company-form input[type=submit]').click(function(){
	
	var companyForm = $.extend($.simplelogform,$.company_form);
	companyForm.Submit($('#company-form'));	
	return false;
});
EOD;
$cs->registerScript('company#create',$script);
?>